<!DOCTYPE html>
<!-- ng-app -->
<html lang="en" ng-app="app">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="../../../js/plugins/angular/angular.min.js" type="text/javascript"></script>
</head>
<body>
    <div ng-controller="cont">
        <button ng-click="ask(false,'您输入的内容不正确')">
            提示框
        </button>
        <button ng-click="ask(true,'您真的要删除这条记录吗？')">
            询问框
        </button>
    </div>

    <script>
        angular.module('app',[])
            .factory('$confirm',['$window',function ($win) {
                return function (msg) {
                    $win.confirm(msg);
                }
            }])
            .service('$notify',['$window','$confirm',function ($win, $con) {
               return function (t,msg) {
                   return (t) ? $con(msg) : $win.alert(msg);
               }
            }])
            .controller('cont',function ($scope,$notify) {
                $scope.ask = function (t,msg) {
                    $notify(t,msg);
                }
            })

    </script>
</body>
</html>